<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition xmlns:ui="http://java.sun.com/jsf/facelets"
                template="../Templates/InnerSystemTemplate.xhtml"
                xmlns:p="http://primefaces.prime.com.tr/ui"
                xmlns:h="http://java.sun.com/jsf/html"
                xmlns:f="http://java.sun.com/jsf/core">
    <ui:define name="head-title">
        <title>Reset Password | Merlion's ERP System</title>
    </ui:define>
    
    <ui:define name="content">                
        <f:view beforePhase="#{resetPasswordManagerBean.initView(event)}">
        <h:form prependId="false">  
                
            <p:panel id="panel" header="Reset Password"> 
                Dear <h:outputText value="#{controller.employee.userName}" />, you need to reset your password in order to use the system.
                <p:ajaxStatus style="width:16px;height:16px;">   
                    <f:facet name="start">   
                        <p:graphicImage value="http://www.primefaces.org:8080/showcase/design/ajaxloading.gif" /> 
                    </f:facet> 
 
                    <f:facet name="complete">   
                        <h:outputText value="" />   
                    </f:facet>   
                </p:ajaxStatus> 
 
                <p:messages /> 
 
                <h:panelGrid columns="3" cellpadding="10"> 
                    
                    <h:outputLabel for="currentPassword" style="font-weight: bold" value="Current Password: " /> 
                    <p:password value="#{resetPasswordManagerBean.currentPassword}" 
                                required="true" 
                                label="Current Password" 
                                requiredMessage="Current password is required." 
                                id="currentPassword" 
                                validator="#{resetPasswordManagerBean.validateCorrectPassword}"
                                minLength="0"
                                feedback="false">
                    </p:password> 
                    <p:message for="currentPassword" /> 

                    <h:outputLabel for="newPassword" style="font-weight: bold" value="New Password: " /> 
                    <p:password value="#{resetPasswordManagerBean.newPassword}" 
                                required="true" 
                                label="New Password" 
                                requiredMessage="New password is required." 
                                id="newPassword" 
                                binding="#{newPassword}"
                                minLength="0"
                                feedback="false">
                    </p:password> 
                    <p:message for="newPassword" /> 
                    
                    <h:outputLabel for="confirmPassword" style="font-weight: bold" value="Confirm Password: " /> 
                    <p:password value="#{resetPasswordManagerBean.confirmPassword}" 
                                 required="true" 
                                 label="Confirm Password" 
                                 requiredMessage="Confirm password is required." 
                                 id="confirmPassword" 
                                 validator="#{resetPasswordManagerBean.validateSamePassword}"
                                 minLength="0"
                                 feedback="false">
                        <f:attribute name="newPassword" value="#{newPassword.value}" />
                    </p:password> 
                    <p:message for="confirmPassword" /> 
                    
                </h:panelGrid>                
                <p:commandButton id="btn" value="Update" update="panel" actionListener="#{resetPasswordManagerBean.changePassword(event, component)}" ajax="true" />
            </p:panel> 

        </h:form>
        </f:view>
    </ui:define>
    <ui:define name="left-content">
        
        Welcome <h:outputText value="#{controller.employee.userName}" />.<br/><br/>
        
    </ui:define>   
</ui:composition>
